﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.IO;

namespace DemSoTable
{
    class Program
    {

        static void Main(string[] args)
        {
            StreamReader rt = new StreamReader(args[0]);
            if (rt == null)
                return;
            string cnStr=rt.ReadLine();
            rt.Close();
            int soBang = 0;
            SqlConnection cn = new SqlConnection(cnStr);
            cn.Open();
            SqlCommand  cmd = new SqlCommand( @"select count(*) from sys.tables where is_ms_shipped='0'",cn);
            soBang  =int.Parse( cmd.ExecuteScalar().ToString ());
            cn.Close();
            Console.WriteLine(soBang);
            StreamWriter wt = new StreamWriter(args[1]);
            wt.WriteLine(soBang);          
            wt.Close();
        }
    }
}
